package com.lianyu.wangyiyun.model;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.List;

/**
 * @author Chen Yuguang
 * @date 2021/5/9 20:25
 */

public class MusicListViewModel extends ViewModel {

    private MutableLiveData<List<Mp3Info>> musicLiveData;

    private MutableLiveData<Integer> positionLiveData;

    private MutableLiveData<Integer> modeLiveData;

    /**
     * 取得储存音乐信息列表的LiveData
     *
     * @return androidx.lifecycle.MutableLiveData<java.util.List < com.lianyu.wangyiyun.model.Mp3Info>>
     * @author Chen Yuguang
     * @date 2021/5/9 20:25
     */
    public MutableLiveData<List<Mp3Info>> getMusicLiveData() {
        if (musicLiveData == null) {
            musicLiveData = new MutableLiveData<>();
        }
        return musicLiveData;
    }

    /**
     * 取得储存当前音乐播放位置信息的LiveData
     * @return androidx.lifecycle.MutableLiveData<java.lang.Integer>
     * @author Chen Yuguang
     * @date 2021/5/15 23:27
     */
    public MutableLiveData<Integer> getPositionLiveData() {
        if (positionLiveData == null) {
            positionLiveData = new MutableLiveData<>();
        }
        return positionLiveData;
    }

    /**
     * 取得储存当前音乐播放模式信息的LiveData
     * @return androidx.lifecycle.MutableLiveData<java.lang.Integer>
     * @author Chen Yuguang
     * @date 2021/5/15 23:27
     */
    public MutableLiveData<Integer> getModeLiveData() {
        if (modeLiveData == null) {
            modeLiveData = new MutableLiveData<>();
            modeLiveData.setValue(0);
        }
        return modeLiveData;
    }

}

